<!--
 * @Author: your name
 * @Date: 2020-04-24 18:10:26
 * @LastEditTime: 2020-04-29 09:30:39
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \five\index.html
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="yes" name="apple-touch-fullscreen"/>
    <meta content="telephone=no,email=no" name="format-detection"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>打碟活动</title>
    <link rel="stylesheet" href="./css/public.css"/>
    <link rel="stylesheet" href="./css/index.css"/>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/svgaplayerweb@2.3.1/build/svga.min.js"></script>
    <script src="./js/htmlfontsize.js"></script>
    <script src="./js/vue.js"></script>
    <script src="./js/common.js"></script>
    <script src="./js/tool.js"></script>
    <script src="./js/flex.js"></script>
</head>
<body>
<div v-cloak="" id="app" class="open">
    <div>
        <!--        <div class="top-close"></div>-->

    </div>

    <div id="svgaOpenBox" :style="backgroundDiv"></div>
    <p class="loading">Loading...</p>

    <!--    <div class="overlay" onclick="hideDialog()"></div>-->

</div>
</body>


<script type="module">
    var app = new Vue({
        el: '#app',
        data: {
            listStage: 1,
            baseUrl: 'http://ztaudio-activity.kekestar.cn',
            baseApiUrl: "https://sl-api.bianxiangapp.com:8866",
            List: [],
            Curr: [],
            log_list: [],
            room_id: 0,
            user_id: 0,
            minute: ['', '', ''],
            consumerDiamond: ['20', '100', '200', '500'],
            diamond: 0,
            dish_type: 0,//0免费 1付费 2为没有开启打碟
            level: 0,//打碟等级
            timer: '',
            click_num_msg: '',
            click_num: '',
            click_msg: '点击参与',
            text_msg: '确认参与打碟活动吗？',
            dialog_message: '简单的提示~',
            canShowTip: false,
            overlayShow: false,
            alertMsg: false,
            alertDiamondMsg: false,
            payDish: false,
            logDish: false,
            ruleDish: false,
            imgPath: '',
            update_html: 0,
            pngImgPath: '',
            backgroundDiv: {
                backgroundImage: ''
            },
            pngImg: [
                '/dish/images/baise.png',
                '/dish/images/hongse.png',
                '/dish/images/huangse.png',
                '/dish/images/lvse.png',
                '/dish/images/juse.png'
            ],
            svgaImg: [
                '/dish/images/baise.svga',
                '/dish/images/1.svga',
                '/dish/images/1.svga',
                '/dish/images/1.svga',
                '/dish/images/1.svga'
            ]
        },
        computed: {},

        mounted() {
            let _this = this
            _this.imgPath = _this.baseUrl + _this.svgaImg[0]
            _this.selectSvga(_this.imgPath)
            _this.dishInfo();
        },
        methods: {
            dishInfo() {
                let _this = this
                kk.ajaxGet(_this.baseUrl + '/dish/jumpRoom', {}, function (res) {
                    if (res.code == 200) {
                        let data = res.data;
                        let room_id = data.room_id + '';
                        if (kk.isAndroid) {
                            keke.roomClicked(room_id)
                            _this.sleep(500)
                        } else if (kk.isIos) {
                            window.webkit.messageHandlers.klsCloseViewRoomClicked.postMessage({
                                room_id: room_id
                            })
                        }
                    } else {
                        alert('未开启打碟爆奖');
                    }
                })
            },
            sleep(ms) {
                return new Promise((resolve, reject) => {
                    setTimeout(() => {
                        kk.openClientView({code: 200001})
                    }, ms)
                })
            },
            selectSvga: function (Img) {
                let _this = this;
                var parser = new SVGA.Parser('#svgaOpenBox')
                var player = new SVGA.Player('#svgaOpenBox')
                parser.load(Img, function (videoItem) {
                    //可以自己替换特定的图像，请您的设计师告诉您ImageKey:jcdxtouxiang
                    player.setVideoItem(videoItem);
                    player.setText({
                        family: 'microsoft yahei',//setText方法 不传 family 属性 size属性会失效
                        text: 'Hello, World!',
                        size: "48px",
                        color: "#000",
                        offset: {x: 0.0, y: 0.0}
                    }, 'jcdxnicheng');//ImageKey:jcdxnicheng
                    player.startAnimation();
                    //player.startAnimationWithRange({location: 20, length: 1}, false);
                }, function (error) {
                })
            }
        }
    })
</script>
</html>
